import useUserInfoStore from '@/store/userInfo'
import { showModalMsg } from './sysMsg'
import { navigateTo } from './navigateTo'

export const LoginStatusCheck = (cabllback: any) => {
  const userInfoStore = useUserInfoStore()
  if (userInfoStore.getUserInfo.userId) {
    cabllback && cabllback()
  } else {
    showModalMsg({
      title: '当前账户未登录',
      content: '',
      options: {
        confirmText: '去登录',
        confirmColor: '#6aa8ff',
      },
      successCallback: async () => navigateTo('/pages/login/index'),
      cancelCallback: async () => {},
    })
  }
}
